﻿using System;
using System.Windows;
using System.Windows.Browser;

namespace SilverQuery
{
	/// <summary>
	/// Base class for any object that wants to make use of the managed jQuery API.
	/// </summary>
	public abstract class SilverQueryObject
	{
		protected SilverQueryObject() { }

		#region Shortcut q methods to the jQuery constructor
		// We can't use the $ sign as a method name in C# so opting for the 
		// single character "q". In C# it is allowed to prefix a member with the
		// @ sign which is intended to be able to use a C# keyword as a member
		// name, but it can be used on any member name.  Prefixing the q methods
		// with the @ symbol better captures the "feel" of the $ function.
		// http://msdn.microsoft.com/en-us/library/aa664670%28VS.71%29.aspx

		protected jQuery @q(string selector)
		{
			return new jQuery(selector);
		}

		protected jQuery @q(string selector, jQuery filter)
		{
			return new jQuery(selector, filter);
		}

		protected jQuery @q(string selector, HtmlElement filter)
		{
			return new jQuery(selector, filter);
		}

		protected jQuery @q(HtmlObject htmlElement)
		{
			return new jQuery(htmlElement);
		}

		protected jQuery @q(HtmlObject htmlElement, jQuery filter)
		{
			return new jQuery(htmlElement, filter);
		}
		#endregion
	}
}
